import { FC, useState } from 'react';
import { Modal, Radio, Space } from 'antd';

interface FeedbackModalProps {
  visible: boolean;
  onClose: () => void;
  onSubmit: (type: string) => void;
}

const feedbackTypes = [
  { label: '格式问题', value: 'format' },
  { label: '逻辑问题', value: 'logic' },
  { label: '有害信息', value: 'harmful' },
  { label: '事实错误', value: 'factual' },
  { label: '没有帮助', value: 'unhelpful' },
  { label: '答非所问', value: 'irrelevant' },
];

const FeedbackModal: FC<FeedbackModalProps> = ({ visible, onClose, onSubmit }) => {
  const [feedbackType, setFeedbackType] = useState('format');

  return (
    <Modal
      title="报告反馈"
      open={visible}
      onCancel={onClose}
      onOk={() => onSubmit(feedbackType)}
      okText="提交"
      cancelText="取消"
    >
      <Radio.Group onChange={(e) => setFeedbackType(e.target.value)} defaultValue="format">
        <Space direction="vertical">
          {feedbackTypes.map(type => (
            <Radio key={type.value} value={type.value}>
              {type.label}
            </Radio>
          ))}
        </Space>
      </Radio.Group>
    </Modal>
  );
};

export default FeedbackModal;
